#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int d=0;
void er(){
	int unit=0,decade=0;
	for(int i=10;i<100;i++){
		unit=i%10;
		decade=i/10;
		if(i==pow(decade,1)+pow(unit,2)){
			d++;
			printf("%d=%d^%d+%d^%d\n",i,decade,1,unit,2);
		}
	}
}
void san(){
	int hundred = 0,decade = 0,unit = 0,i = 0;
	for (i = 100; i < 1000; i++){
		hundred = i / 100;
		decade = (i / 10) % 10;
		unit = i % 10;
		if (i == pow(hundred, 1) + pow(decade, 2) + pow(unit, 3))
		{
			d++;
			printf("%d=%d^%d+%d^%d+%d^%d\n", i,hundred,1,decade,2,unit,3);
		}
	}
}
void si(){
	int hundred = 0,decade = 0,unit = 0,thousand=0,i = 0;
	for (i = 1000; i < 10000; i++){
		thousand=i/1000;
		hundred = (i / 100)%10;
		decade = (i / 10) % 10;
		unit = i % 10;
		if (i ==pow(thousand,1)+pow(hundred, 2) + pow(decade, 3) + pow(unit, 4))
		{
			d++;
			printf("%d=%d^%d+%d^%d+%d^%d+%d^%d\n", i,thousand,1,hundred,2,decade,3,unit,4);
		}
	}
}

int main(){
	er();
	san();
	si();
	printf("Total:%d",d);
}
